#!/usr/bin/env python

from skaffold import Test, Failure
from skaffold.testers.command import Command

help_expect = \
"""Usage: skaffold.py [-C config1 [-C config2]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -V, --verbose         Verbose output (default False)
  -C CONFIG_FILE, --config=CONFIG_FILE
                        Load a Skaffold configuration file (may be used
                        repeatedly)
""".strip()

version_expect = "skaffold.py 0.0.1".strip()

def help_text_validate(result):
    if result['stdout'].strip()!=help_expect:
        raise Failure("Invalid help text returned")

def version_text_validate(result):
    if result['stdout'].strip()!=version_expect:
        raise Failure("Invalid version text returned")

suite += [
Test("Args: -h",        Command, command="skaffold.py", args=["-h"], check_stdout=help_text_validate),
Test("Args: --help",    Command, command="skaffold.py", args=["--help"], check_stdout=help_text_validate),
Test("Args: --badoption",Command, command="skaffold.py", args=["--badoption"]),
Test("Args: --version", Command, command="skaffold.py", args=["--version"], check_stdout=version_text_validate)
]